from myblog import db
import datetime


class Label(db.Model):
    __tablename__ = 'b_label'
    id = db.Column(db.Integer, primary_key=True)
    article_id = db.Column(db.Integer)
    label = db.Column(db.String(100))
    # 创建时间
    create_at = db.Column(db.DateTime, default=datetime.datetime.now)
    # 更新时间
    update_at = db.Column(
        db.DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)

    def __init__(self, article_id, label):
        self.article_id = article_id
        self.label = label

    def __repr__(self):
        return '<Label %r>' % self.article_id
